package com.olap.starter.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.olap.starter.core.base.BaseService;
import com.olap.starter.mapper.FormMainColumnMapper;
import com.olap.starter.pojo.FormMain;
import com.olap.starter.pojo.FormMainColumn;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author WBG
 * @since 2022-12-21
 */
@Service
@AllArgsConstructor
@DS("online")
public class FormMainColumnServices extends BaseService<FormMainColumnMapper, FormMainColumn> {

    private final FormMainServices formMainServices;

    public List<FormMainColumn> getListByUUid(long uuid) {
        FormMain formMain = formMainServices.getOne(new LambdaQueryWrapper<FormMain>().eq(FormMain::getUuid, uuid).eq(FormMain::getDeleted, 0).select(FormMain::getId));
        return list(new LambdaQueryWrapper<FormMainColumn>().eq(FormMainColumn::getParentId, formMain.getId()));
    }
}
